<?php

namespace App\Http\Models;

/**
 * Class Model
 * @package App\Http\Models
 */
class Model extends \Illuminate\Database\Eloquent\Model
{



    /**
     * @param $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    public function Validator($data)
    {
        $class=static::class;
        $curClass =(new $class);

        $rules=$curClass->rules($data);
        $messages=!isset($curClass->messages)?[]:$curClass->messages;
        $attribute=!isset($curClass->attribute)?[]:$curClass->attribute;

        $validator = \Illuminate\Support\Facades\Validator::make($data, $rules, $messages, $attribute);
        return $validator;
    }
}